package o;

import android.graphics.Matrix;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

@RequiresApi(21)
class nb implements nf {
    private static Class<?> ˊ;
    private static boolean ˋ;
    private static Method ˎ;
    private static Method ˏ;
    private static boolean ॱ;
    private static boolean ॱॱ;
    private final View ᐝ;

    static nf ॱ(View view, ViewGroup viewGroup, Matrix matrix) {
        ॱ();
        if (ˏ != null) {
            try {
                return new nb((View) ˏ.invoke(null, new Object[]{view, viewGroup, matrix}));
            } catch (IllegalAccessException e) {
            } catch (InvocationTargetException e2) {
                throw new RuntimeException(e2.getCause());
            }
        }
        return null;
    }

    static void ˊ(View view) {
        ˊ();
        if (ˎ != null) {
            try {
                ˎ.invoke(null, new Object[]{view});
            } catch (IllegalAccessException e) {
            } catch (InvocationTargetException e2) {
                throw new RuntimeException(e2.getCause());
            }
        }
    }

    private nb(@NonNull View view) {
        this.ᐝ = view;
    }

    public void setVisibility(int i) {
        this.ᐝ.setVisibility(i);
    }

    public void ˏ(ViewGroup viewGroup, View view) {
    }

    private static void ˏ() {
        if (!ॱ) {
            try {
                ˊ = Class.forName("android.view.GhostView");
            } catch (Throwable e) {
                Log.i("GhostViewApi21", "Failed to retrieve GhostView class", e);
            }
            ॱ = true;
        }
    }

    private static void ॱ() {
        if (!ˋ) {
            try {
                ˏ();
                ˏ = ˊ.getDeclaredMethod("addGhost", new Class[]{View.class, ViewGroup.class, Matrix.class});
                ˏ.setAccessible(true);
            } catch (Throwable e) {
                Log.i("GhostViewApi21", "Failed to retrieve addGhost method", e);
            }
            ˋ = true;
        }
    }

    private static void ˊ() {
        if (!ॱॱ) {
            try {
                ˏ();
                ˎ = ˊ.getDeclaredMethod("removeGhost", new Class[]{View.class});
                ˎ.setAccessible(true);
            } catch (Throwable e) {
                Log.i("GhostViewApi21", "Failed to retrieve removeGhost method", e);
            }
            ॱॱ = true;
        }
    }
}
